home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / standard / floor.z / floor
Encoding:
Text File  |  2002-10-03  |  9.5 KB  |  167 lines

  1. FLOOR(3M)                                              Last changed: 1-8-99
  2.  
  3.  
  4. NNAAMMEE
  5.      fflloooorr, fflloooorrll, fffflloooorr, fflloooorrff, cceeiill, cceeiillll, ffcceeiill, cceeiillff, ccooppyyssiiggnn,
  6.      ccooppyyssiiggnnll, ddrreemm, ddrreemmll, ffmmoodd, ffmmooddll, ffmmooddff, ffaabbssll, ffaabbss, ffaabbssff,
  7.      rreemmaaiinnddeerr, rriinntt, rriinnttll, ttrruunncc, ttrruunnccll, ffttrruunncc, ttrruunnccff - Floor,
  8.      ceiling, remainder, absolute value, nearest integer, and truncation
  9.      functions
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<mmaatthh..hh>>
  13.  
  14.      ddoouubbllee fflloooorr ((ddoouubbllee xx));;
  15.      lloonngg ddoouubbllee fflloooorrll ((lloonngg ddoouubbllee xx));;
  16.      ffllooaatt fffflloooorr ((ffllooaatt xx));;
  17.      ffllooaatt fflloooorrff ((ffllooaatt xx));;
  18.  
  19.      ddoouubbllee cceeiill ((ddoouubbllee xx));;
  20.      lloonngg ddoouubbllee cceeiillll ((lloonngg ddoouubbllee xx));;
  21.      ffllooaatt ffcceeiill ((ffllooaatt xx));;
  22.      ffllooaatt cceeiillff ((ffllooaatt xx));;
  23.  
  24.      ddoouubbllee ccooppyyssiiggnn ((ddoouubbllee xx,, ddoouubbllee yy));;
  25.      lloonngg ddoouubbllee ccooppyyssiiggnnll \\
  26.                ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
  27.  
  28.      ""ddoouubbllee ddrreemm ((ddoouubbllee xx,, ddoouubbllee yy));;""
  29.      lloonngg ddoouubbllee ddrreemmll \\
  30.                ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
  31.  
  32.      ""ddoouubbllee rreemmaaiinnddeerr ((ddoouubbllee xx,, ddoouubbllee yy));;""
  33.  
  34.      ddoouubbllee ttrruunncc ((ddoouubbllee xx));;
  35.      lloonngg ddoouubbllee ttrruunnccll ((lloonngg ddoouubbllee xx));;
  36.      ffllooaatt ffttrruunncc ((ffllooaatt xx));;
  37.      ffllooaatt ttrruunnccff ((ffllooaatt xx));;
  38.  
  39.      ddoouubbllee ffmmoodd ((ddoouubbllee xx,, ddoouubbllee yy));;
  40.      lloonngg ddoouubbllee ffmmooddll \\
  41.                ((lloonngg ddoouubbllee xx,, lloonngg ddoouubbllee yy));;
  42.      ffllooaatt ffmmooddff ((ffllooaatt xx,, ffllooaatt yy));;
  43.  
  44.      ddoouubbllee ffaabbss ((ddoouubbllee xx));;
  45.      lloonngg ddoouubbllee ffaabbssll ((lloonngg ddoouubbllee xx));;
  46.      ffllooaatt ffaabbssff ((ffllooaatt xx));;
  47.  
  48.      ddoouubbllee rriinntt ((ddoouubbllee xx));;
  49.      lloonngg ddoouubbllee rriinnttll ((lloonngg ddoouubbllee xx));;
  50.  
  51. IIMMPPLLEEMMEENNTTAATTIIOONN
  52.      IRIX systems
  53.  
  54. DDEESSCCRRIIPPTTIIOONN
  55.      The ffmmoodd, ffaabbss, and ttrruunncc functions listed in the SYNOPSIS as well as
  56.      the long double and single-precision versions of the remaining
  57.      functions, are only available in the standard math library, --llmm,, and
  58.      in --llmmxx.
  59.  
  60.      The fflloooorr functions return the largest integer not greater than _x.
  61.      The argument _x is ddoouubbllee for fflloooorr, lloonngg ddoouubbllee for fflloooorrll, and ffllooaatt
  62.      for fffflloooorr and its ANSI-named equivalent fflloooorrff.
  63.  
  64.      ccooppyyssiiggnn((xx,,yy)) returns the number with the magnitude of _x and the sign
  65.      of _y.  ccooppyyssiiggnnll is the lloonngg ddoouubbllee counterpart of ccooppyyssiiggnn.
  66.  
  67.      ddrreemm((xx,,yy)) returns the remainder rr ::== xx -- _n**yy where _n is the integer
  68.      nearest the exact value of xx//yy; moreover, if ||nn--xx//yy||==11//22 then _n is
  69.      even.  Consequently, the remainder is computed exactly and ||rr|| <<
  70.      ||yy||//22.  But ddrreemm((xx,,00)) is exceptional; see the DIAGNOSTICS section on
  71.      this man page.  rreemmaaiinnddeerr is an alternate entry point for ddrreemm.  ddrreemmll
  72.      is the lloonngg ddoouubbllee counterpart of ddrreemm.
  73.  
  74.      The cceeiill functions return the smallest integer not less than _x.  The
  75.      argument _x is ddoouubbllee for cceeiill, lloonngg ddoouubbllee for cceeiillll, and ffllooaatt for
  76.      ffcceeiill and its ANSI-named equivalent cceeiillff.
  77.  
  78.      The ttrruunncc functions return the integer (represented as a floating-
  79.      point number) of _x with the fractional bits truncated.  The argument _x
  80.      is ddoouubbllee for ttrruunncc, lloonngg ddoouubbllee for ttrruunnccll, and ffllooaatt for ffttrruunncc.
  81.  
  82.      ffaabbss returns the absolute value of the ddoouubbllee _x, |_x|.  It also has
  83.      counterparts of type lloonngg ddoouubbllee and ffllooaatt,, namely ffaabbssll, and ffaabbssff,
  84.      respectively.
  85.  
  86.      rriinntt returns the integer (represented as a double precision number)
  87.      nearest its ddoouubbllee argument _x in the direction of the prevailing
  88.      rounding mode.  rriinnttll is the lloonngg ddoouubbllee counterpart of rriinntt.  rriinntt
  89.      has no counterpart that accepts an argument of type ffllooaatt.
  90.  
  91.      ffmmoodd returns the floating-point remainder of the division of its
  92.      ddoouubbllee arguments _x by _y.  It returns a number _f with the same sign as
  93.      _x, such that "_x = _i_y + _f" for some integer _i, and |_f| < |_y|.  Hence,
  94.      the following two invocations yield 00..55:
  95.  
  96.                fmod(2.5,1.0)
  97.                fmod(2.5,-1.0)
  98.  
  99.      while the following two invocations yield --00..55:
  100.  
  101.                fmod(-2.5,1.0)
  102.                fmod(-2.5,-1.0)
  103.  
  104.      ffmmooddll is the counterpart of ffmmoodd which accepts and returns values of
  105.      type lloonngg ddoouubbllee, and ffmmooddff is the counterpart of ffmmoodd which accepts
  106.      and returns values of type ffllooaatt.
  107.  
  108. DDIIAAGGNNOOSSTTIICCSS
  109.      In the following diagnostics, functions in the standard math library
  110.      lliibbmm..aa, are referred to as --llmm versions, those in math library lliibbmmxx..aa
  111.      are referred to as --llmmxx versions, and those in the the BSD math
  112.      library lliibbmm4433..aa are referred to as --llmm4433 versions.  The --llmm and --llmmxx
  113.      versions always return the default Quiet NaN and set eerrrrnnoo to EDOM
  114.      when a NaN is used as an argument.  A NaN argument usually causes the
  115.      --llmm4433 versions to return the same argument.  The --llmm4433 versions never
  116.      set eerrrrnnoo.  The value of HUGE_VAL is IEEE Infinity.
  117.  
  118.      If _y (and, possibly, _x) are zero, or if _x is +/-HUGE_VAL, the ffmmoodd
  119.      functions return a quiet NaN, and set eerrrrnnoo to EDOM.
  120.  
  121.      IEEE 754 defines ddrreemm((xx,,00)) and ddrreemm((iinnffiinniittyy,,yy)) to be invalid
  122.      operations that produce a .
  123.  
  124.      A version of the double-precision ffaabbss function exists in the C
  125.      library as well.  The C library version may not behave correctly when
  126.      the input is NaN.
  127.  
  128. NNOOTTEESS
  129.      Long double operations on this system are only supported in round to
  130.      nearest rounding mode (the default).  The system must be in round to
  131.      nearest rounding mode when calling any of the long double functions,
  132.      or incorrect answers will result.
  133.  
  134.      Users concerned with portability to other computer systems should note
  135.      that the long double and float versions of these functions are
  136.      optional according to the ANSI C Programming Language Specification
  137.      ISO/IEC 9899 : 1990 (E).
  138.  
  139.      Long double functions have been renamed to be compliant with the
  140.      ANSI-C standard, however to be backward compatible, they may still be
  141.      called with the double precision function name prefixed with a qq.
  142.      (Exceptions:  functions ffaabbssll and ffmmooddll may be called with names qqaabbss
  143.      and qqmmoodd, respectively.)
  144.  
  145.      In the default rounding mode, round to nearest, rriinntt((xx)) is the integer
  146.      nearest _x with the additional stipulation that if ||rriinntt((xx))--xx||==11//22 then
  147.      rriinntt((xx)) is even.  Other rounding modes can make rriinntt act like fflloooorr,
  148.      or like cceeiill, or round towards zero.
  149.  
  150.      Another way to obtain an integer near x is to declare the following
  151.      (in C):
  152.  
  153.           double x;    int k;    k=x;
  154.  
  155.      The C compilers round _x towards zero to get the integer _k.  Also note
  156.      that, if _x is larger than _k can accommodate, the value of _k and the
  157.      presence or absence of an integer overflow are hard to detect.
  158.  
  159.      IEEE 754 requires ccooppyyssiiggnn((xx,,NNaann)) == +__+xx.  In this implementation of
  160.      ccooppyyssiiggnn, the sign of NaN is ignored.  Thus, ccooppyyssiiggnn((xx,,+__+NNaaNN)) = +_x,
  161.      and ccooppyyssiiggnn((+__+NNaaNN,,xx)) == ++NNaaNN.
  162.  
  163. SSEEEE AALLSSOO
  164.      aabbss(3C), mmaatthh(3M), mmaatthheerrrr(3M)
  165.  
  166.      This man page is available only online.
  167.